/*
 * @Author: your name
 * @Date: 2020-09-10 11:05:38
 * @LastEditTime: 2020-09-10 11:45:42
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \PipeOneMap_WebClient\src\app\shared\components\search-tools\search-tools.component.ts
 */
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';

@Component({
  selector: 'app-search-tools',
  templateUrl: './search-tools.component.html',
  styleUrls: ['./search-tools.component.scss']
})
export class SearchToolsComponent implements OnInit {
  @Output() itemEventEmitter = new EventEmitter<any>();
  @Input() data = null;
  // 当前选择项
  selectitem = '';

  constructor() { }

  ngOnInit() {
  }

  // 点击事件
  itemChange(item) {
    // 点击的是自己，不做反应或者恢复默认
    if (item.title === this.selectitem) {
      return;
      // this.selectitem = '';
    } else {
      this.selectitem = item.title;
    }
    // 拿到item后往外传消息
    this.itemEventEmitter.emit(item);
  }

}
